/*
 * @Author: cz
 * @Date: 2019-05-13 10:51
 * @Last Modified by:
 * @Last Modified time: 2019-05-13 10:51
 * @Description: 课题相关
 */

import request from '@/router/axios'
import { pimUrls } from '@/const/apiUrl'

/**
 * 添加模型
 * @param {*} query
 */
export function addModel (query) {
  return request({
    url: pimUrls.addModel,
    method: 'post',
    data: query
  })
}
/**
 * 获取模型详情
 */
export function modelDetail (id) {
  return request({
    url: pimUrls.modelDeDetail + id,
    method: 'get'
  })
}
/**
 * 模型修改
 */
export function editModel (query) {
  return request({
    url: pimUrls.editModel + query.id,
    method: 'put',
    data: query
  })
}

/**
 * 模型列表查询
 * @param {*} query
 */
export function modelPageList (query) {
  return request({
    url: pimUrls.modelPageList,
    method: 'get',
    params: query
  })
}

/**
 * 添加监测项
 * @param {*} query
 */
export function addWorkingItem (query) {
  return request({
    url: pimUrls.addWorkingItem,
    method: 'post',
    data: query
  })
}

/**
 * 监测项列表
 * @param {*} query
 */
export function workingItemPageList (query) {
  return request({
    url: pimUrls.workingItemPageList,
    method: 'get',
    params: query
  })
}

/**
 * 获取监测项详情
 */
export function workingItemDetail (id) {
  return request({
    url: pimUrls.workingItemDetail + id,
    method: 'get'
  })
}
/**
 * 监测项修改
 */
export function editWorkingItem (query) {
  return request({
    url: pimUrls.editWorkingItem + query.id,
    method: 'put',
    data: query
  })
}

/**
 * 监测项进度字段列表
 * @param {*} query
 */
export function workingitemfieldPageList (query) {
  return request({
    url: pimUrls.workingitemfieldPageList,
    method: 'get',
    params: query
  })
}
/**
 * 自定义字段列表
 * @param {*} query
 */
export function customfieldPageList (query) {
  return request({
    url: pimUrls.customfieldPageList,
    method: 'get',
    params: query
  })
}

/**
 * 添加进度字段
 * @param {*} query
 */
export function addProgressFiled (query) {
  return request({
    url: pimUrls.addProgressFiled,
    method: 'post',
    data: query
  })
}
/**
 * 删除进度字段
 */
export function deleteProgressFiled (query) {
  return request({
    url: pimUrls.deleteProgressFiled + query.id,
    method: 'delete',
    data: query
  })
}
/**
 * 发布监测项
 */
export function publishWorkingItem (query) {
  return request({
    url: pimUrls.publishWorkingItem + query.id,
    method: 'put',
    data: query
  })
}
/**
 * 模型树
 */
export function getModelTree (query) {
  return request({
    url: pimUrls.getModelTree,
    method: 'get',
    data: query
  })
}




/**
 * 获取监测评估列表
 * @param {*} query
 */
export function getEvaluationList (query) {
  return request({
    url: pimUrls.getEvaluationList,
    method: 'get',
    params: query
  })
}

/**
 * 新增实施评估
 * @param {*} query
 */
export function addEvaluation (query) {
  return request({
    url: pimUrls.addEvaluation,
    method: 'post',
    data: query
  })
}

/**
 * 新增报告成果
 * @param {*} query
 */
export function addReportResult (query) {
  return request({
    url: pimUrls.addReportResult,
    method: 'post',
    data: query
  })
}


/**
 * 新增分解方案
 * @param {*} query
 */
export function addDecomposeDraft (query) {
  return request({
    url: pimUrls.addDecomposeDraft,
    method: 'post',
    data: query
  })
}

/**
 * 新增分解方案征求意见
 * @param {*} query
 */
export function addProgramOpinion (query) {
  return request({
    url: pimUrls.addProgramOpinion,
    method: 'post',
    data: query
  })
}

/**
 * 获取实施评估详情
 * @param {*} query
 */
export function getEvaluation (id) {
  return request({
    url: pimUrls.getEvaluation + id,
    method: 'get'
  })
}

/**
 * 获取分解方案详情
 * @param {*} query
 */
export function getProgramDetail (id) {
  return request({
    url: pimUrls.getProgramDetail + id,
    method: 'get'
  })
}

/**
 * 获取分解方案列表
 * @param {*} query
 */
export function getDecomposeDraftList (query) {
  return request({
    url: pimUrls.getDecomposeDraftList,
    method: 'get',
    params: query,
  })
}

/**
 * 获取报告成果列表
 * @param {*} query
 */
export function getReportResultList (query) {
  return request({
    url: pimUrls.getReportResultList,
    method: 'get',
    params: query,
  })
}

/**
 * 获取分解方案详情分解项列表
 * @param {*} query
 */
export function decomposeDraftDetailList (query) {
  return request({
    url: pimUrls.decomposeDraftDetailList,
    method: 'get',
    params: query,
  })
}

/**
 * 获取分解方案详情分解项列表是本部门的
 * @param {*} query
 */
export function decomposeDraftDetailListUnit (query) {
  return request({
    url: pimUrls.decomposeDraftDetailListUnit,
    method: 'get',
    params: query,
  })
}

/**
 * 获取分解方案详情分解项列表不是本部门的
 * @param {*} query
 */
export function decomposeDraftDetailListOthers (query) {
  return request({
    url: pimUrls.decomposeDraftDetailListOthers,
    method: 'get',
    params: query,
  })
}

/**
 * 获取分解方案反馈意见其他意见列表
 * @param {*} query
 */
export function getOtherOpninionList (query) {
  return request({
    url: pimUrls.getOtherOpninionList,
    method: 'get',
    params: query,
  })
}

/**
 * 修改分解方案详情分解项列表
 * @param {*} query
 */
export function modifyProgramDetail (id, data) {
  return request({
    url: pimUrls.modifyProgramDetail + id,
    method: 'put',
    data: data,
  })
}

/**
 * 下达方案
 * @param {*} data
 */
export function releaseProgram (data) {
  return request({
    url: pimUrls.releaseProgram,
    method: 'post',
    data: data
  })
}

/**
 * 分解项新增
 * @param {*} obj
 */
export function addDecomposition (obj) {
  return request({
    url: pimUrls.addDecomposition,
    method: 'post',
    data: obj
  })
}

/**
 * 分解项删除
 * @param {*} id
 */
export function delDecomposition (id) {
  return request({
    url: pimUrls.delDecomposition + id,
    method: 'delete'
  })
}
/**
 * 获取分解项详情
 * @param {*} id
 */
export function decomposeItemDetail (id) {
  return request({
    url: pimUrls.decomposeItemDetail + id,
    method: 'get'
  })
}
/**
 * 获取默认征求部门
 * @param {*} id
 */
export function getItemUnits (id) {
  return request({
    url: pimUrls.getItemUnits + id,
    method: 'get'
  })
}

/**
 * 分解项修改
 * @param {*} id
 */
export function modifyDecomposition (id, data) {
  return request({
    url: pimUrls.modifyDecomposition + id,
    method: 'put',
    data: data
  })
}
/**
 * 获取分解项目标信息分页list
 * @param {*} data
 */
export function workingItemTargetPage (data) {
  return request({
    url: pimUrls.workingItemTargetPage,
    method: 'get',
    params: data
  })
}

/**
 * 查看意见信息
 * @param {*} data
 */
export function getItemOpinion (id) {
  return request({
    url: pimUrls.getItemOpinion + id,
    method: 'get',
  })
}


/**
 * 获取分解项树的分页list
 * @param {*} data
 */
export function getItemTreeList (data) {
  return request({
    url: pimUrls.getItemTreeList,
    method: 'get',
    params: data
  })
}

/**
 * 获取分解项分页list-用于监测评估查看进度页面
 * @param {*} data
 */
export function decomposeItemItemPage (data) {
  return request({
    url: pimUrls.decomposeItemItemPage,
    method: 'get',
    params: data
  })
}


/**
 * 获取规划和报告树的分页list
 * @param {*} data
 */
export function getPlanReportPageTree (data) {
  return request({
    url: pimUrls.getPlanReportPageTree,
    method: 'get',
    params: data
  })
}

/**
 * 获取目标list信息
 * @param {*} id
 */
export function workingItemTargetList (id) {
  return request({
    url: pimUrls.workingItemTargetList + id,
    method: 'get'
  })
}

/**
 * 新增分解项目标
 * @param {*} data
 */
export function addWorkingItemTarget (data) {
  return request({
    url: pimUrls.addWorkingItemTarget,
    method: 'post',
    data: data
  })
}

/**
 * 删除分解项目标
 * @param {*} id
 */
export function deleteWorkingItemTarget (id) {
  return request({
    url: pimUrls.deleteWorkingItemTarget + id,
    method: 'delete'
  })
}

/**
 * 分解项目标修改
 * @param {*} id
 * @param {*} data
 */
export function modifyWorkingItemTarget (id, data) {
  return request({
    url: pimUrls.modifyWorkingItemTarget + id,
    method: 'put',
    data: data
  })
}

/**
 * 获取目标list信息
 * @param {*} mainTitle
 */
export function decomposeDraftProgressTree (mainTitle) {
  return request({
    url: pimUrls.decomposeDraftProgressTree,
    method: 'get',
    params: mainTitle
  })
}

/**
 * 获取目标待办监测评估列表信息
 * @param {*} query
 */
export function toDoReportList (query) {
  return request({
    url: pimUrls.toDoReportList,
    method: 'get',
    params: query
  })
}


/**
 * 分页查询，能够修订调整的规划成果
 * @param {*} query
 */
export function getReviseAchievementList (query) {
  return request({
    url: pimUrls.getReviseAchievementList,
    method: 'get',
    params: query
  })
}


/**
 * 获取修订调整建议分页list(报告成果录入)
 * @param {*} query
 */
export function getAdjustResultList (query) {
  return request({
    url: pimUrls.getAdjustResultList,
    method: 'get',
    params: query
  })
}

/**
 * 获取进度历史列表
 * @param {*} ditemId
 */
export function progressOldProgress (ditemId) {
  return request({
    url: pimUrls.progressOldProgress + ditemId,
    method: 'get',
  })
}


/**
 * 获取进度填报信息
 * @param {*} ditemId
 */
export function getProgressApplyData (id) {
  return request({
    url: pimUrls.getProgressApplyData + id,
    method: 'get',
  })
}


/**
 *获取指标进度信息list
 * @param {*} ditemId
 */
export function getOldTargetList (id) {
  return request({
    url: pimUrls.getOldTargetList + id,
    method: 'get',
  })
}

/**
 *获取任务进度信息list
 * @param {*} ditemId
 */
export function getOldTaskList (id) {
  return request({
    url: pimUrls.getOldTaskList + id,
    method: 'get',
  })
}

/**
 *获取任务进度信息list
 * @param {*} ditemId
 */
export function getOldProjectList (id) {
  return request({
    url: pimUrls.getOldProjectList + id,
    method: 'get',
  })
}


/**
 *获取历史进度（不包括自己）(项目)
 * @param {*} ditemId
 */
export function getReportProgressHisProject (id) {
  return request({
    url: pimUrls.getReportProgressHisProject + id,
    method: 'get',
  })
}

/**
 *获取历史进度（不包括自己）(任务)
 * @param {*} ditemId
 */
export function getReportProgressHisTask (id) {
  return request({
    url: pimUrls.getReportProgressHisTask + id,
    method: 'get',
  })
}

/**
 *获取历史进度（不包括自己）(指标)
 * @param {*} ditemId
 */
export function getReportProgressHisTarget (id) {
  return request({
    url: pimUrls.getReportProgressHisTarget + id,
    method: 'get',
  })
}

/**
 * 进度新增
 * @param {*} data
 */
export function addProgress (data) {
  return request({
    url: pimUrls.addProgress,
    method: 'post',
    data: data,
  })
}


/**
 * 指标进度上报
 * @param {*} data
 */
export function submitTargetProgress (data) {
  return request({
    url: pimUrls.submitTargetProgress,
    method: 'post',
    data: data,
  })
}

/**
 * 任务进度上报
 * @param {*} data
 */
export function submitTaskProgress (data) {
  return request({
    url: pimUrls.submitTaskProgress,
    method: 'post',
    data: data,
  })
}

/**
 * 项目进度上报
 * @param {*} data
 */
export function submitProjectProgress (data) {
  return request({
    url: pimUrls.submitProjectProgress,
    method: 'post',
    data: data,
  })
}

/**
 * 入库新增修订调整
 * @param {*} data
 */
export function addAdjustResult (data) {
  return request({
    url: pimUrls.addAdjustResult,
    method: 'post',
    data: data,
  })
}

/**
 *新增修订调整，并提交
 * @param {*} data
 */
export function submitReportOpinion (data) {
  return request({
    url: pimUrls.submitReportOpinion,
    method: 'post',
    data: data,
  })
}

/**
 *新增修订调整，起草调整建议
 * @param {*} data
 */
export function creatReportOpinion (data) {
  return request({
    url: pimUrls.creatReportOpinion,
    method: 'post',
    data: data,
  })
}
/**
 *修改调整建议
 * @param {*} data
 */
export function editReportOpinion (id, data) {
  return request({
    url: pimUrls.editReportOpinion + id,
    method: 'put',
    data: data,
  })
}


/**
 *修改报告成果
 * @param {*} data
 */
export function reportResultEdit (id, data) {
  return request({
    url: pimUrls.reportResultEdit + id,
    method: 'put',
    data: data,
  })
}

/**
 *指标进度list修改
 * @param {*} data
 */
export function editTargetProgress (data) {
  return request({
    url: pimUrls.editTargetProgress,
    method: 'put',
    data: data,
  })
}

/**
 *任务进度list修改
 * @param {*} data
 */
export function editTaskProgress (data) {
  return request({
    url: pimUrls.editTaskProgress,
    method: 'put',
    data: data,
  })
}

/**
 *项目进度list修改
 * @param {*} data
 */
export function editProjectProgress (data) {
  return request({
    url: pimUrls.editProjectProgress,
    method: 'put',
    data: data,
  })
}

/**
 *修改调整建议
 * @param {*} data
 */
export function releaseReportOpinion (id) {
  console.log('hello world')
  return request({
    url: pimUrls.releaseReportOpinion + id,
    method: 'put',
  })
}

/**
 *修改修订调整，并重报，发展规划
 * @param {*} data
 */
export function submitReportOpinionEdit (id, data) {
  return request({
    url: pimUrls.submitReportOpinionEdit + id,
    method: 'post',
    data: data,
  })
}

/**
 *修改修订调整，并重报，重点专项
 * @param {*} data
 */
export function submitReportOpinionImpt (id, data) {
  return request({
    url: pimUrls.submitReportOpinionImpt + id,
    method: 'post',
    data: data,
  })
}

/**
 *修改修订调整，并重报，备案专项
 * @param {*} data
 */
export function submitReportOpinionCommon (id, data) {
  return request({
    url: pimUrls.submitReportOpinionCommon + id,
    method: 'post',
    data: data,
  })
}

/**
 * 报告新增
 * @param {*} data
 */
export function addReport (data) {
  return request({
    url: pimUrls.addReport,
    method: 'post',
    data: data,
  })
}

/**
 * 分解项反馈意见新增
 * @param {*} data
 */
export function submitItemOpinion (data) {
  return request({
    url: pimUrls.submitItemOpinion,
    method: 'post',
    data: data,
  })
}

/**
 * 报告征求意见新增
 * @param {*} data
 */
export function addPimOpinion (data) {
  return request({
    url: pimUrls.addPimOpinion,
    method: 'post',
    data: data,
  })
}


/**
 * 获取报告信息
 * @param {*} id
 */
export function getReportDetail (id) {
  return request({
    url: pimUrls.getReportDetail + id,
    method: 'get',
  })
}

/**
 * 获取报告信息
 * @param {*} id//pmuc
 */
export function getPmucReportDetail (id) {
  return request({
    url: pimUrls.getPmucReportDetail + id,
    method: 'get',
  })
}

/**
 * 获取修订调整信息
 * @param {*} id
 */
export function getReportOpinionDetail (id) {
  return request({
    url: pimUrls.getReportOpinionDetail + id,
    method: 'get',
  })
}

/**
 * 修改报告信息
 * @param {*} id
 * @param {*} data
 */
export function modifyReport (id, data) {
  return request({
    url: pimUrls.modifyReport + id,
    method: 'put',
    data: data
  })
}

/**
 * 报告审定
 * @param {*} id
 * @param {*} data
 */
export function reportValidate (id, data) {
  return request({
    url: pimUrls.reportValidate + id,
    method: 'put',
    data: data
  })
}

/**
 * 报告修改
 * @param {*} id
 * @param {*} data
 */
export function reportEdit (id, data) {
  return request({
    url: pimUrls.reportEdit + id,
    method: 'put',
    data: data
  })
}

/**
 * 修订调整政府审核
 * @param {*} id
 * @param {*} data
 */
export function governmentValidate (id, data) {
  return request({
    url: pimUrls.governmentValidate + id,
    method: 'put',
    data: data
  })
}

/**
 * 修订调整政府审核第二次
 * @param {*} id
 * @param {*} data
 */
export function governmentValidateTwo (id) {
  return request({
    url: pimUrls.governmentValidateTwo + id,
    method: 'put',
  })
}

/**
 * 修订调整省委审核
 * @param {*} id
 * @param {*} data
 */
export function committeeValidate (id, data) {
  return request({
    url: pimUrls.committeeValidate + id,
    method: 'put',
    data: data
  })
}

/**
 * 修订调整人大审议
 * @param {*} id
 * @param {*} data
 */
export function congressValidate (id, data) {
  return request({
    url: pimUrls.congressValidate + id,
    method: 'put',
    data: data
  })
}

/**
 * 修订调整发改审核
 * @param {*} id
 * @param {*} data
 */
export function DRcheckValidate (id, data) {
  return request({
    url: pimUrls.DRcheckValidate + id,
    method: 'put',
    data: data
  })
}

/**
 * 修订调整政府审批
 * @param {*} id
 * @param {*} data
 */
export function govApprovalValidate (id, data) {
  return request({
    url: pimUrls.govApprovalValidate + id,
    method: 'put',
    data: data
  })
}

/**
 * 修订调整发改审批 一般专项
 * @param {*} id
 * @param {*} data
 */
export function DRcheckApprovalValidate (id, data) {
  return request({
    url: pimUrls.DRcheckApprovalValidate + id,
    method: 'put',
    data: data
  })
}

/**
 * 报告修改
 * @param {*} id
 * @param {*} data
 */
export function exportDraftFile (draftId) {
  var url = pimUrls.exportDraftFile.replace("{draftId}", draftId);
  return request({
    url: url,
    method: 'get',
    responseType: 'blob'
  })
}

/**
 * 导出进度
 * @param {*} id
 * @param {*} data
 */
export function exportProgressFile (id) {
  return request({
    url: pimUrls.exportProgressFile + id,
    method: 'get',
    responseType: 'blob'
  })
}

/**
 * 报告人大审议
 * @param {*} id
 * @param {*} data
 */
export function reportReview (id, data) {
  return request({
    url: pimUrls.reportReview + id,
    method: 'put',
    data: data,
  })
}

/**
 * 上报报告
 * @param {*} id
 */
export function releaseReport (id) {
  return request({
    url: pimUrls.releaseReport + id,
    method: 'put',
  })
}

/**
 * 待处理审批任务（当前用户），分页查询
 * @param {*} query
 */
export function taskTodo (query) {
  return request({
    url: pimUrls.taskTodo,
    method: 'get',
    params: query
  })
}

/**
 * 政府确认退回
 * @param {*} id
 */
export function taskZfReturn (id) {
  return request({
    url: pimUrls.taskZfReturn + id,
    method: 'put',
  })

}


/**
 * 获取修订调整处理历史信息
 * @param {*} query
 */
export function getReviseHistory (query) {
  return request({
    url: pimUrls.getReviseHistory,
    method: 'get',
    params: query
  })
}

/**
 * 获取报告流程处理历史信息
 * @param {*} query
 */
export function getReportHistory (query) {
  return request({
    url: pimUrls.getReportHistory,
    method: 'get',
    params: query
  })
}

/**
 * 获取任务详情
 * @param {*} taskId
 */
export function getAdjustOpinionData (taskId) {
  return request({
    url: pimUrls.getAdjustOpinionData + taskId,
    method: 'get',
  })
}

/**
 * 获取修订调整详情
 * @param {*} taskId
 */
export function getReviseDetail (id) {
  return request({
    url: pimUrls.getReviseDetail + id,
    method: 'get',
  })
}

/**
 * 修改分解方案
 * @param {*} taskId
 * @param {*} data
 */
export function taskDecompose (taskId, data) {
  return request({
    url: pimUrls.taskDecompose + taskId,
    method: 'put',
    data: data
  })
}

/**
 * 修改分解方案-modify
 * @param {*} taskId
 * @param {*} data
 */
export function taskModifyItem (taskId, data) {
  return request({
    url: pimUrls.taskModifyItem + taskId,
    method: 'put',
    data: data
  })
}

/**
 * 修改分解方案-edit
 * @param {*} taskId
 * @param {*} data
 */
export function taskEditItem (taskId, data) {
  return request({
    url: pimUrls.taskEditItem + taskId,
    method: 'put',
    data: data
  })
}

/**
 * 修改分解方案-update
 * @param {*} taskId
 * @param {*} data
 */
export function taskUpdateItem (taskId, data) {
  return request({
    url: pimUrls.taskUpdateItem + taskId,
    method: 'put',
    data: data
  })
}

/**
 * 修改分解方案-有建议
 * @param {*} taskId
 * @param {*} data
 */
export function taskDraftEdit (taskId, data) {
  return request({
    url: pimUrls.taskDraftEdit + taskId,
    method: 'put',
    data: data
  })
}


/**
 * 报告党委审核
 * @param {*} taskId
 * @param {*} data
 */
export function taskDwAudit (id, data) {
  return request({
    url: pimUrls.taskDwAudit + id,
    method: 'put',
    data: data,
  })
}

/**
 * 报告政府二次审定
 * @param {*} taskId
 */
export function taskZfAuditTwo (id) {
  return request({
    url: pimUrls.taskZfAuditTwo + id,
    method: 'put',
  })
}


/**
 * 判断流程
 * @param {*} taskId
 * @param {*} data
 */
export function judgeExist (id) {
  return request({
    url: pimUrls.judgeExist + id,
    method: 'put',
  })
}

/**
 * 政府印发
 * @param {*} id
 * @param {*} data
 */
export function taskZfPrintRevise (id, data) {
  return request({
    url: pimUrls.taskZfPrintRevise + id,
    method: 'put',
    data: data,
  })
}
/**
 * 政府印发一般专项
 * @param {*} id
 * @param {*} data
 */
export function releaseAdjustCommon (id, data) {
  return request({
    url: pimUrls.releaseAdjustCommon + id,
    method: 'put',
    data: data,
  })
}
/**
 * 政府印发备案专项
 * @param {*} id
 * @param {*} data
 */
export function releaseAdjustCongress (id, data) {
  return request({
    url: pimUrls.releaseAdjustCongress + id,
    method: 'put',
    data: data,
  })
}

/**
 * 发改委印发
 * @param {*} id
 * @param {*} data
 */
export function taskFgwPrintRevise (id, data) {
  return request({
    url: pimUrls.taskFgwPrintRevise + id,
    method: 'put',
    data: data,
  })
}
/**
 * 发改代拟
 * @param {*} id
 * @param {*} data
 */
export function DRReplaceApproval (id, data) {
  return request({
    url: pimUrls.DRReplaceApproval + id,
    method: 'put',
    data: data,
  })
}

/**
 * 政府印发
 * @param {*} id
 * @param {*} data
 */
export function govReleaseAdjust (id, data) {
  return request({
    url: pimUrls.govReleaseAdjust + id,
    method: 'put',
    data: data,
  })
}

/**
 * 导出进度上报信息excel
 * @param {*}
 * @param {*}
 */
export function exportToDoWorkItemDataExcel () {
  return request({
    url: pimUrls.exportToDoWorkItemDataExcel,
    method: 'get',
    responseType: 'blob',
  })
}



/**
 * 导出监测评估信息excel
 * @param {*}
 * @param {*}
 */
export function exportToDoReportDataExcel (query) {
  return request({
    url: pimUrls.exportToDoReportDataExcel,
    method: 'get',
    responseType: 'blob',
    params: query
  })
}

/**
 * 导出修订调整信息excel
 * @param {*}
 * @param {*}
 */
export function exportToDoAdjustDataExcel (query) {
  return request({
    url: pimUrls.exportToDoAdjustDataExcel,
    method: 'get',
    responseType: 'blob',
    params: query
  })
}
